<?php
/**
 * Created by PhpStorm.
 * User: Duke
 * Date: 2019/11/4
 * Time: 11:35
 * 后台分类
 */
namespace App\Model;

use App\Model\BaseModel;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Events\StatementPrepared;
class AdminMenuModel extends BaseModel{
    protected $table = 'admin_menu';
    //获取列表数据
    public function getList($is_pid = '',$pid = 0){
        if($is_pid){
            return DB::table($this->table)->where(['pid'=>$pid,'state'=>1])->get()->toArray();
        }else{
            return DB::table($this->table)->where('state',1)->get()->toArray();
        }
    }
    //展示数据
    public function insert_info($data){
        return DB::table($this->table)->insert($data);
    }
    //查找一条数据
    public function find_info($id = ''){
        return DB::table($this->table)->where(['id'=>$id])->first();
    }
    //更新数据
    public function update_info($data){
        return DB::table($this->table)->where('id',$data['id'])->update($data);
    }
    //删除数据
    public function del($id = ''){
        return DB::table($this->table)->delete(['id'=>$id]);
    }
}
